<?php
/* @var $this UserController */
/* @var $model User */
/* @var $form CActiveForm */

$this->main_menu = MenuHelper::getArrayForMainMenu(true, false, false);

?>

<?php
$this->widget('bootstrap.widgets.TbTabs', array(
	'type'=>'tabs', // 'tabs' or 'pills'
	'tabs'=> array(
		array('label'=>'Alle Kunden', 'url'=>$this->createUrl('user/admin'), 'active'=>false),
                array('label'=>'NEU', 'url'=>$this->createUrl('user/create'), 'active'=>false),
//                array('label'=>'|', 'itemOptions'=>array('class'=>'disabled')),
                array('label'=>'Stammdaten', 'url'=>$this->createUrl('user/update', array('id'=>$model->user_id)), 'active'=>false),
                array('label'=>'Info', 'url'=>$this->createUrl('user/info', array('user_id'=>$model->user_id)), 'active'=>false),
                array('label'=>'Rechnungsadressen', 'url'=>$this->createUrl('user/viewInvoiceAddresses', array('user_id'=>$model->user_id)), 'active'=>true),
                array('label'=>'Kurse', 'url'=>$this->createUrl('user/getCourseForUser', array('id'=>$model->user_id))),
//                array('label'=>'|', 'itemOptions'=>array('class'=>'disabled')),
		
	),
));
?>

<div id="invoice_address_form">

<?php    
    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'horizontalForm',
	'type'=>'horizontal',
)); ?>

<div class="form wide">
<?php
 
// see http://www.yiiframework.com/doc/guide/1.1/en/form.table
// Note: Can be a route to a config file too,
//       or create a method 'getMultiModelForm()' in the member model

$memberFormConfig = array(
      'elements'=>array(
          'type'=>array(
            'type'=>'text',
              'disabled'=>true,
              'class'=>'span1',
            ),
            'name'=>array(
               'type'=>'text', 
                'class'=>'span2',
            ),
            'nr'=>array(
               'type'=>'text', 
                'class'=>'span1',
            ),
            'contact'=>array(
               'type'=>'text', 
                'class'=>'span2',
            ),
            'address'=>array(
                'type'=>'text',
                'maxlength'=>40,
                'class'=>'span2',
            ),
            'postcode'=>array(
                'type'=>'text',
                'maxlength'=>40,
                'class'=>'span1',
            ),
            'place'=>array(
             'type'=>'text', 
              'class'=>'span2',
            ),
            'tel'=>array(
               'type'=>'text', 
                'class'=>'span2',
            ),
            'email'=>array(
               'type'=>'text', 
                'class'=>'span2',
            ),
            'url'=>array(
               'type'=>'text', 
                'class'=>'span2',
          ),
    ));    

$this->widget('ext.multimodelform.MultiModelForm',array(
        'id' => 'user_id', //the unique widget id
        'formConfig' => $memberFormConfig, //the form configuration array
        'model' => $invoiceAddress, //instance of the form model
        'tableView' => true,
        //if submitted not empty from the controller,
        //the form will be rendered with validation errors
        'validatedItems' => $validatedMembers,
//        'bootstrapLayout'=> true,
        //array of invoiceAddress instances loaded from db
        'data' => $invoiceAddress->findAll('user_id=:user_id', array(':user_id'=>$model->user_id)),
        'allowAddItem' => false,
        'allowRemoveItem' => false,
    ));
?>
    
<div class="form-actions">
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'Speichern')); ?>
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Zurücksetzen')); ?>
</div>
 
<?php $this->endWidget(); ?>
 
</div><!-- form -->

</div>
